package com.arellomobile.android.push;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import java.util.Calendar;

public class AlarmReceiver extends BroadcastReceiver
{
  private static final int MAX_ALARMS = 10;
  private static int counter = 0;

  public static void clearAlarm(Context paramContext)
  {
    for (int i = 0; ; i++)
    {
      if (i >= 10)
        return;
      PendingIntent localPendingIntent = PendingIntent.getBroadcast(paramContext, i, new Intent(paramContext, AlarmReceiver.class), 134217728);
      ((AlarmManager)paramContext.getSystemService("alarm")).cancel(localPendingIntent);
    }
  }

  public static void setAlarm(Context paramContext, String paramString, Bundle paramBundle, int paramInt)
  {
    Calendar localCalendar = Calendar.getInstance();
    localCalendar.add(13, paramInt);
    Intent localIntent = new Intent(paramContext, AlarmReceiver.class);
    localIntent.putExtra("title", paramString);
    localIntent.putExtra("local", true);
    if (paramBundle != null)
      localIntent.putExtras(paramBundle);
    int i = counter;
    counter = i + 1;
    PendingIntent localPendingIntent = PendingIntent.getBroadcast(paramContext, i, localIntent, 134217728);
    if (counter == 10)
      counter = 0;
    ((AlarmManager)paramContext.getSystemService("alarm")).set(0, localCalendar.getTimeInMillis(), localPendingIntent);
  }

  public void onReceive(Context paramContext, Intent paramIntent)
  {
    Intent localIntent = new Intent(paramContext, PushGCMIntentService.class);
    localIntent.setAction("com.google.android.c2dm.intent.RECEIVE");
    localIntent.putExtras(paramIntent.getExtras());
    paramContext.startService(localIntent);
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.arellomobile.android.push.AlarmReceiver
 * JD-Core Version:    0.6.2
 */